package com.lzp.copyui.mvvmtest

import android.os.Bundle
import androidx.lifecycle.Observer
import com.base.mvvm.BaseMvvmActivity
import com.base.mvvm.BindViewModel
import com.lzp.copyui.R
import kotlinx.android.synthetic.main.mvvm_test_activity.*

/**
 * @describe:
 * @Author: lixiaopeng
 * @Date: 11/30/20
 */
class MVVMTestActivity :BaseMvvmActivity(){

    @BindViewModel
    private lateinit var viewModel:MvvmTestViewModel

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.mvvm_test_activity)
    }

    override fun getData() {
        super.getData()
        viewModel.let {
            it.doTest()
            it.testLiveData.observe(this,object :Observer<String>{
                override fun onChanged(t: String?) {
                    testTv.text = t
                }
            })
        }
    }

}